package cn.tedu.sp04.feign;

import cn.tedu.sp01.pojo.User;
import cn.tedu.web.util.JsonResult;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestParam;

/**
 * @author 木木
 * @Email 1194660762@qq.com
 * @date 2021/8/13 14:29
 */
@FeignClient(name = "user-service")
public interface UserClient {
    @GetMapping("{userId}")
    JsonResult<User> getUser(@PathVariable("userId") Integer userId);

    @GetMapping("{userId}/score")   // ?score=100
    JsonResult<?> addScore(@PathVariable Integer userId,
                           @RequestParam("socre") Integer score);//若提交的参数名与接收的参数名一致,则可以省略
}
